<%@page pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/views/common/taglibs-include.jsp"%>
<script type="text/javascript">
$(function(){
	
	$('#prePage').click(function(){
		var page = parseInt($('#pageNum').val());
		page = page - 1 < 1 ? ${pageBean.pages} : page - 1;
		turnPage(page);
	});
	
	$('#nextPage').click(function(){
		var page = parseInt($('#pageNum').val());
		page = page + 1 > ${pageBean.pages} ? 1 : page + 1;
		turnPage(page);
	});
	
	$('[name=pageBtn]').click(function(){
		turnPage($(this).attr("page"));
	});
});

function turnPage(page)
{
	$('#pageNum').val(page);
	$('#searchForm').submit();
}
</script>
<c:if test="${pageBean.pages > 1 }">
<div class="row">
    <div class="col-md-5 col-sm-12">
        <div role="status">显示${((pageBean.pageNum-1)*pageBean.pageSize)+1 } 到 ${((pageBean.pageNum-1)*pageBean.pageSize) + (fn:length(pageBean.rows)) } 共 ${pageBean.total } 条</div>
    </div>
    <div class="col-md-7">
        <ul class="pagination pagination-sm pull-right">
            <li>
                <a><i class="fa fa-angle-double-left"></i></a>
            </li>
            <li>
                <a id="prePage">
                    <i class="fa fa-angle-left"></i>
                </a>
            </li>
            <c:forEach var="num" begin="${pageBean.pageNum - 4 < 1 ? 1 :  pageBean.pageNum - 4 }" step="1" end="${pageBean.pageNum + 4 > pageBean.pages ? pageBean.pages : pageBean.pageNum + 4 }">
                <li <c:if test="${pageBean.pageNum == num }">class="active"</c:if>>
                    <a name="pageBtn" page="${num }">${num }</a>
                </li>
            </c:forEach>
            <li>
                <a id="nextPage">
                    <i class="fa fa-angle-right"></i>
                </a>
            </li>
            <li>
                <a><i class="fa fa-angle-double-right"></i></a>
            </li>
        </ul>
    </div>
</div>
</c:if>